<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>


    <script>
        var xhr = new XMLHttpRequest();

        xhr.onload = function () {
            console.log(JSON.parse(xhr.responseText));
        }

        xhr.open('POST', 'http://bufantec.com/api/test/user/save');
        xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
        var obj = {
            name: "李白", // 昵称
            age: 14,
            sex: 0,
            tel: 12346578,
            address: "长安城东北角",
            school: "长安吟诗学院",
            username: "554", // 登录名
            password: 123456
        }

        var str = '';
        for (const i in obj) {
            str += '&' + i + '=' + obj[i];
        }
        str = str.slice(1);

        xhr.send(str);
    </script>
</body>
</html>